//
//  MainView.m
//  IpadTestB
//
//  Created by edianzu on 2017/6/27.
//  Copyright © 2017年 ruilai. All rights reserved.
//

#import "MainView.h"

@implementation MainView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/
-(instancetype)initWithFrame:(CGRect)frame{
    if ([super initWithFrame:frame]) {
        [self creatUI];
    }
    return self;
}

-(void) creatUI{
    self.backgroundColor =UIColorFromRGB(241, 244, 248);
    
    _myScrollView = [[UIScrollView alloc]init];
    _myScrollView.backgroundColor = UIColorFromRGB(241, 244, 248);
    _myScrollView.contentSize = CGSizeMake(0, 1000);
    _myScrollView.scrollEnabled =YES;
    _myScrollView.showsVerticalScrollIndicator=NO;
    [self addSubview:_myScrollView];
    [_myScrollView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left);
        make.top.mas_equalTo(self.mas_top);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH, SCREEN_HEIGHT));
    }];
    
    self.childListBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.childListBtn setImage:[UIImage imageNamed:@"childListBtn"] forState:UIControlStateNormal];
    [self.myScrollView addSubview:self.childListBtn];
    [self.childListBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_myScrollView.mas_top).with.offset(40*AutoScaleVertical);
        make.left.mas_equalTo(_myScrollView.mas_left).with.offset(SCREEN_WIDTH/5/2  *AutoScaleHorizontal);
        make.size.mas_equalTo(CGSizeMake((SCREEN_WIDTH/5-15)*AutoScaleHorizontal, 100*AutoScaleVertical));
    }];
    
    self.classManageBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.classManageBtn setImage:[UIImage imageNamed:@"classManageBtn"] forState:UIControlStateNormal];
    [self.myScrollView addSubview:self.classManageBtn];
    [self.classManageBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_myScrollView.mas_top).with.offset(40*AutoScaleVertical);
        make.left.mas_equalTo(self.childListBtn.mas_right).with.offset(10*AutoScaleHorizontal);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH/5*AutoScaleHorizontal, 100*AutoScaleVertical));
    }];
    self.testPlanBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.testPlanBtn setImage:[UIImage imageNamed:@"testPlanBtn"] forState:UIControlStateNormal];
    [self.myScrollView addSubview:self.testPlanBtn];
    [self.testPlanBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_myScrollView.mas_top).with.offset(40*AutoScaleVertical);
        make.left.mas_equalTo(self.classManageBtn.mas_right).with.offset(10*AutoScaleHorizontal);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH/5*AutoScaleHorizontal, 100*AutoScaleVertical));
    }];
    self.saleSituationBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.saleSituationBtn setImage:[UIImage imageNamed:@"saleSituation"] forState:UIControlStateNormal];
    [self.myScrollView addSubview:self.saleSituationBtn];
    [self.saleSituationBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(_myScrollView.mas_top).with.offset(40*AutoScaleVertical);
        make.left.mas_equalTo(self.testPlanBtn.mas_right).with.offset(10*AutoScaleHorizontal);
        make.size.mas_equalTo(CGSizeMake(SCREEN_WIDTH/5*AutoScaleHorizontal, 100*AutoScaleVertical));
    }];
    
    self.testingLabel = [[UILabel alloc]init];
    self.testingLabel.text = @"进行中的测试计划";
    self.testingLabel.textColor = [UIColor blackColor];
    self.testingLabel.font = [UIFont boldSystemFontOfSize:20*AutoScaleHorizontal];
    [self.myScrollView addSubview:self.testingLabel];
    [self.testingLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.childListBtn.mas_left);
        make.top.mas_equalTo(self.childListBtn.mas_bottom).with.offset(50*AutoScaleVertical);
        make.size.mas_equalTo(CGSizeMake(170*AutoScaleHorizontal, 25*AutoScaleVertical));
    }];
    
    self.testingLine = [[UIView alloc]init];
    self.testingLine.backgroundColor = UIColorFromRGB(231, 206, 205);
    [self.myScrollView addSubview:self.testingLine];
    [self.testingLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.testingLabel.mas_right).with.offset(15*AutoScaleHorizontal);
        make.centerY.mas_equalTo(self.testingLabel.mas_centerY);
        make.right.mas_equalTo(self.saleSituationBtn.mas_right);
        make.height.mas_equalTo(1);
    }];
}
@end




















